package com.ruoyi.receipt.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.receipt.utils.UserInitUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.receipt.mapper.TbExampleSubjectOptionMapper;
import com.ruoyi.receipt.domain.TbExampleSubjectOption;
import com.ruoyi.receipt.service.ITbExampleSubjectOptionService;

/**
 * 例题选项Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-31
 */
@Service
public class TbExampleSubjectOptionServiceImpl implements ITbExampleSubjectOptionService 
{
    @Autowired
    private TbExampleSubjectOptionMapper tbExampleSubjectOptionMapper;

    /**
     * 查询例题选项
     * 
     * @param id 例题选项ID
     * @return 例题选项
     */
    @Override
    public TbExampleSubjectOption selectTbExampleSubjectOptionById(Long id)
    {
        return tbExampleSubjectOptionMapper.selectTbExampleSubjectOptionById(id);
    }

    /**
     * 查询例题选项列表
     * 
     * @param tbExampleSubjectOption 例题选项
     * @return 例题选项
     */
    @Override
    @DataScope(deptAlias = "da",userAlias = "createId")
    public List<TbExampleSubjectOption> selectTbExampleSubjectOptionList(TbExampleSubjectOption tbExampleSubjectOption)
    {
        return tbExampleSubjectOptionMapper.selectTbExampleSubjectOptionList(tbExampleSubjectOption);
    }

    /**
     * 新增例题选项
     * 
     * @param tbExampleSubjectOption 例题选项
     * @return 结果
     */
    @Override

    public int insertTbExampleSubjectOption(TbExampleSubjectOption tbExampleSubjectOption)
    {
        UserInitUtils.initUserInfo(tbExampleSubjectOption);
        tbExampleSubjectOption.setCreateTime(DateUtils.getNowDate());
        return tbExampleSubjectOptionMapper.insertTbExampleSubjectOption(tbExampleSubjectOption);
    }

    /**
     * 修改例题选项
     * 
     * @param tbExampleSubjectOption 例题选项
     * @return 结果
     */
    @Override
    public int updateTbExampleSubjectOption(TbExampleSubjectOption tbExampleSubjectOption)
    {
        UserInitUtils.initUserInfoForUpdate(tbExampleSubjectOption);
        tbExampleSubjectOption.setUpdateTime(DateUtils.getNowDate());
        return tbExampleSubjectOptionMapper.updateTbExampleSubjectOption(tbExampleSubjectOption);
    }

    /**
     * 批量删除例题选项
     * 
     * @param ids 需要删除的例题选项ID
     * @return 结果
     */
    @Override
    public int deleteTbExampleSubjectOptionByIds(Long[] ids)
    {
        return tbExampleSubjectOptionMapper.deleteTbExampleSubjectOptionByIds(ids);
    }

    /**
     * 删除例题选项信息
     * 
     * @param id 例题选项ID
     * @return 结果
     */
    @Override
    public int deleteTbExampleSubjectOptionById(Long id)
    {
        return tbExampleSubjectOptionMapper.deleteTbExampleSubjectOptionById(id);
    }

    @Override
    public Long selectTbExampleSubjectOptionName(String content) {
        return tbExampleSubjectOptionMapper.selectTbExampleSubjectOptionName(content);
    }

    @Override
    public List<String> selectTbExampleSubjectOptionMangagerId(Long id) {
        return tbExampleSubjectOptionMapper.selectTbExampleSubjectOptionMangagerId(id);
    }

    @Override
    public int deleteTbExampleSubjectOptionSMId(Long id) {
        return tbExampleSubjectOptionMapper.deleteTbExampleSubjectOptionSMId(id);
    }

    @Override
    public List selectoptionAll(Long subjectManagerId) {
        return tbExampleSubjectOptionMapper.selectoptionAll(subjectManagerId);
    }
}
